<table width="90%" border=0 align="left" cellpadding=0 cellspacing=0 class="main-txt">
<tbody>
<?php // Categories list dymanic	
//$which_class   = $_GET['which_class'];	
$catfile = "categories.txt";
//if($which_class=='')$which_class = "Audio & Multimedia";
if(file_exists($catfile)) {
	$catary = file($catfile);
	$lastmajor = "xxnone"; 
	for($i=0; $i<count($catary); $i++) {
		$cdisplist = rtrim($catary[$i]);
		$cmachlist = rawurlencode($cdisplist);
		$cdisp2list = explode("::", htmlspecialchars($cdisplist));
		$cmach2list = explode("%3A%3A", $cmachlist);
		$upurl = base64_encode($cmach2list[0]);
		$majorlink = "<tr>
                      <td width=13><a 
                  href=\"\"><img 
                  height=17 alt=\"\" hspace=0 
                  src=\"images/cat-bullet-expanded.gif\" 
                  width=13 align=left border=0></a></td>
                      <td class=cat_0_expanded><a class=cat_0 
                  href=\"index02_w_$upurl.html\">$cdisp2list[0]</a></td>
                </tr>";
		$curl = base64_encode($cmachlist);
		$minorlink = "<tr><td width=13><img height=17 alt=\"\" hspace=0  src=\"images/cat-bullet-1-gen.gif\"  width=13 align=left border=0></td>
<td class=cat_1><a class=cat_0  href=\"index02_w_$curl.html\">$cdisp2list[1]</a></td>
                    </tr>"; 			

		if($cmach2list[0] != $lastmajor) {
			$lastmajor = $cmach2list[0];
			//echo "$which_class.$cdisp2list[0]";
			if(substr($which_class,0,4)==substr($cdisp2list[0],0,4)){
				echo "$majorlink "; // Added for major categories
				echo "$minorlink "; // Added for the first subcategory
			}elseif(!isset($which_class)) {
			
				echo "$majorlink "; // Added for major categories
				echo "$minorlink "; // Added for the first subcategory
			}else{
				echo "$majorlink "; // Added for major categories
			}	
		}else {
			if(substr($which_class,0,4)==substr($cdisp2list[0],0,4)){
			echo $minorlink; // Added for all the next subcategories
			}elseif(!isset($which_class)) {
			echo $minorlink; // Added for all the next subcategories	
			}
		}
	}
}		  
?>
</tbody>
</table>            